﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Supersense.db;

public partial class admin_login : System.Web.UI.Page
{
    Database db = new Database();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
        else
        {
            String username = Request.Form["username"];
            String passwd = Request.Form["passwd"];
            String sql = "select * from ss_username WHERE username = '" + username + "' and password = '" + passwd + "'";
            SqlDataReader dr = db.executereader(sql);
            if (dr != null && dr.HasRows)
            {
                while (dr.Read())
                {
                    Session["username"] = username;
                    Session["name"] = dr["name"];
                    Response.Redirect("default.aspx");
                }
            }
            else
            {
                Response.Write(3);
            }
        }
    }
}